﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SlackOff
{
    public class SlackOffFinishState : ITimeState
    {
        private ITimeStateContext context;
        private readonly string description;
        public SlackOffFinishState(ITimeStateContext context)
        {
            this.context = context;
            this.description = (new TimeLeft(this.context.Options.WorkingTimeMinutes)).GetTimeLeft().ToString();
        }
        public Status Status => Status.SlackOffFinish;

        public string GetDescription()
        {
            return this.description;
        }

        public void Start()
        {
            this.context.ChangeState(new WorkingTimeState(this.context));
        }

        public bool CanStart
        {
            get
            {
                return true;
            }
        }

        public void Delay()
        {
            this.context.ChangeState(new SlackOffTimeState(this.context, this.context.Options.SlackOffDelayingMinutes));
        }

        public bool CanDelay
        {
            get
            {
                return true;
            }
        }

        public void TryFinish()
        {

        }


        public string StartButtonText => String.Format(this.context.Options.SlackOffFinishStartButtonText,this.context.Options.WorkingTimeMinutes);
        public string DelayButtonText => String.Format(this.context.Options.SlackOffFinishDelayButtonText, this.context.Options.SlackOffDelayingMinutes);


    }
}
